home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Games Machine 76
/
XENIATGM66.iso
/
Indiana Jones
/
Indiana Jones.exe
/
RESOURCE
/
PREVIEW.GOB
/
cog_gen_doordouble.cog
< prev
next >
Wrap
Text File
|
1999-11-15
|
3KB
|
120 lines
# Jones 3D Cog Script
#
# gen_DoorDouble.cog
#
# Door Script
#
# [SXC]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ========================================================================================
symbols
message startup
message activate
message arrived
message blocked
thing door0 linkid=0
thing door1 linkid=1
flex movespeed=8.0
flex sleeptime=2.0
float lightValueR=0.5
float lightValueG=0.5
float lightValueB=0.5
vector vecLightValue local
sector doorsector local
int numdoors local
int doorstatus local
int movestatus local
sector doorsector2 local
# subroutines
flex checkstatus=0.0 local
flex open_doors=0.0 local
flex close_doors=0.0 local
end
code
# .................................................................................................
startup:
if (door0 >= 0) numdoors = numdoors + 1;
if (door1 >= 0) numdoors = numdoors + 1;
doorsector = getthingsector(door0);
doorsector2 = getthingsector(door1);
sectoradjoins(doorsector, 0);
sectoradjoins(doorsector2, 0);
// add light to door sector
vecLightValue = VectorSet(lightValueR, lightValueG, lightValueB);
sectorlight(doorsector, vecLightValue, 0.0);
sectorlight(doorsector2, vecLightValue, 0.0);
return;
# .................................................................................................
activated:
call checkstatus;
if (movestatus) return;
if (doorstatus == 0) { // all pieces are at frame 0
sectoradjoins(doorsector, 1);
sectoradjoins(doorsector2, 1);
call open_doors;
}
return;
# .................................................................................................
arrived:
call checkstatus;
if (movestatus) return;
if (doorstatus == numdoors) { // all pieces are at frame 1
sleep(sleeptime);
call close_doors;
} else if (doorstatus == 0) { // all pieces are at frame 0
sectoradjoins(doorsector, 0);
sectoradjoins(doorsector2, 0);
}
return;
# .................................................................................................
blocked:
call open_doors;
return;
# .................................................................................................
open_doors:
movetoframe(door0, 1, movespeed);
if (door1 >= 0) movetoframe(door1, 1, movespeed);
return;
# .................................................................................................
close_doors:
movetoframe(door0, 0, movespeed);
if (door1 >= 0) movetoframe(door1, 0, movespeed);
return;
# .................................................................................................
checkstatus:
movestatus = ismoving(door0);
if (door1 >= 0) movestatus = movestatus + ismoving(door1);
doorstatus = getcurframe(door0);
if (door1 >= 0) doorstatus = doorstatus + getcurframe(door1);
return;
end